//
//  UploadAvatarTask.m
//  ZooNgonDoiOS
//
//  Created by Anh Jun Linh Tinh on 7/5/12.
//  Copyright (c) 2012 Personal. All rights reserved.
//

#import "UploadAvatarTask.h"
#import "RKRequestSerialization.h"

@implementation UploadAvatarTask
-(id)initWithPhoto:(UIImage *)photo{
    self = [super init];
    if(self){
        _photo = photo;
    }
    return self;
}

-(void)doExecute{
    NSData *data = UIImagePNGRepresentation(_photo);
    RKRequestSerialization *serialization = [RKRequestSerialization serializationWithData:data MIMEType:@"image/png"];
    [[RKClient sharedClient] post:@"/user/avatar" params:serialization delegate:self];
}

-(void)request:(RKRequest *)request didFailLoadWithError:(NSError *)error{
    
}

-(void)request:(RKRequest *)request didLoadResponse:(RKResponse *)response{

}

@end
